<?php

class IndexController extends Controller
{
    public $defaultAction = 'index';
    public $layout = '//layouts/admin';
    public function filters()
    {
        return array('accessControl',);
    }
    public function accessRules()
    {
        return array(
            array(
                'allow',
                'actions' => array('authOnly'),
                'users' => array('@'),
            ),
            array
            (
                'allow',
                'actions' => array('index','ext','mail'),
                'users' => array('admin'),
            ),
            array('deny'),
        );
    }
    public function actionIndex()
	{
        $this->render('index');

	}
    public function actionExt()
    {
        $modules = new ModuleCategores();
        $this->render('ext', array('modules'=>$modules->attributeNames()));
    }
    public function actionMail($message = 'Hello World!',$subject = 'Test')
    {
        Yii::app()->mailer->Host = 'ox.dengionline.com';
        Yii::app()->mailer->IsSMTP();
        Yii::app()->mailer->From = 'a.pronkin@dengionline.com';
        Yii::app()->mailer->FromName = 'Wei';
        Yii::app()->mailer->AddReplyTo('a.pronkin@dengionline.com');
        Yii::app()->mailer->AddAddress('a.pronkin@dengionline.com');
        Yii::app()->mailer->Subject = $subject;
        Yii::app()->mailer->Body = $message;
        Yii::app()->mailer->Send();
        $this->render('index');
    }
}